package com.ruoyi.common.tools.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum DeviceTypeEnum {
    // 1	人员 2	车辆
    CAR("2", "车辆"),
    USER("1", "人员");


    private String code;

    private String serviceType;

    public static DeviceTypeEnum getServiceTypeEnumByCode(String code) {
        for (DeviceTypeEnum s : DeviceTypeEnum.values()) {
            if (s.code.equalsIgnoreCase(code)) {
                return s;
            }
        }
        return null;
    }

    public static String getServiceTypeByCode(String code) {
        for (DeviceTypeEnum s : DeviceTypeEnum.values()) {
            if (s.code.equalsIgnoreCase(code)) {
                return s.getServiceType();
            }
        }
        return null;
    }

    public static String getCodeByServiceType(String serviceType) {
        for (DeviceTypeEnum s : DeviceTypeEnum.values()) {
            if (s.serviceType.equals(serviceType)) {
                return s.code;
            }
        }
        return "0";
    }
}
